﻿using System;
using System.Collections.Generic;
using GameEditor.View.Components;
using GameEngine.Model.Data;
using GameEngine.View;
using PureMVC.Interfaces;

namespace GameEditor.View
{
    public class LevelPropertiesEditor_MenuMediator<ItemVOId>
        : MenuMediator<ILevelEditorMenuViewConstants.ButtonTags, ILevelEditorMenuView<ItemVOId>>
        where ItemVOId : IComparable<ItemVOId>
    {
        public LevelPropertiesEditor_MenuMediator(
            string name,
            ILevelEditorMenuView<ItemVOId> view,
            string outCommand)
            : base(name, view, outCommand)
        {
        }

        public new ILevelEditorMenuView<ItemVOId> ViewComponent
        {
            get { return base.ViewComponent as ILevelEditorMenuView<ItemVOId>; }
        }

        #region IMediator Members

        /// <summary>
        /// List the <c>INotification</c> names this <c>Mediator</c> is interested in being notified of
        /// </summary>
        /// <returns>The list of <c>INotification</c> names </returns>
        override public IList<string> ListNotificationInterests()
        {
            IList<String> notifications = base.ListNotificationInterests();
            return notifications;
        }

        /// <summary>
        /// Handle <c>INotification</c>s
        /// </summary>
        /// <param name="notification">The <c>INotification</c> instance to handle</param>
        /// <remarks>
        ///     <para>
        ///        Typically this will be handled in a switch statement, with one 'case' entry per <c>INotification</c> the <c>Mediator</c> is interested in. 
        ///     </para>
        /// </remarks>
        override public void HandleNotification(INotification notification)
        {
            switch (notification.Name)
            {
                default:
                    break;
            }
            base.HandleNotification(notification);
        }

        /// <summary>
        /// Called by the View when the Mediator is registered
        /// </summary>
        override public void OnRegister()
        {
        }

        /// <summary>
        /// Called by the View when the Mediator is removed
        /// </summary>
        override public void OnRemove()
        {
        }

        #endregion

        public string LevelName
        {
            get { return ViewComponent.LevelName; }
            set { ViewComponent.LevelName = value; }
        }
        public void AddWorld(IWorldVOId id) { ViewComponent.AddWorld(id); }
        public void RemoveWorld(IWorldVOId id) { ViewComponent.RemoveWorld(id); }
        public List<IWorldVOId> GetWorlds() { return ViewComponent.GetWorlds(); }
        public IWorldVOId SelectedWorld { get { return ViewComponent.SelectedWorld; } }
    }
}